package com.example.admin.goodnews.adapter;

import android.content.Context;
import android.net.Uri;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Gallery;
import android.widget.ImageView;

import com.bumptech.glide.Glide;

import java.util.ArrayList;

/**
 * 相册适配器
 * Created by admin on 2016/10/24.
 */

public class GalleryAdapter extends BaseAdapter {
    private Context context;
    private ArrayList<String> gallerylist;

    public GalleryAdapter(Context context, ArrayList<String> gallerylist) {
        this.context = context;
        this.gallerylist = gallerylist;
    }


    @Override
    public int getCount() {
        return gallerylist.size();
    }

    @Override
    public Object getItem(int position) {
        return position;
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ImageView imageView = new ImageView(context);
        Glide.with(context).load(gallerylist.get(position)).into(imageView);
        imageView.setLayoutParams(new Gallery.LayoutParams(150, 75));
        return imageView;
    }
}
